1. Field of the Invention
The present invention relates to an application programming interface (API) for writing a scriptable plug-in.
2. Background Art
Platform independent programming languages allow a virtual machine to be opened in a host application. The virtual machine creates its own environment within the host application and runs computer programs in its environment without regard to the type of computer system the host application is running. This is useful, for instance, when a person is using the Internet and the virtual machine is opened in a host application such as a web browser.
To extend the functionality of the web browser, plug-ins are used. The use of a plug-in allows a developer to write a computer program that performs some desired task from within the web browser. For instance, a common plug-in relates to sound. When a web page on the Internet is encountered that uses sound, the appropriate plug-in is initiated and it instructs the web browser how to handle the sounds and play them for the user.
An application program interface (API) is often used by a developer to create plug-ins. Current plug-in APIs are non-scriptable, meaning that they cannot be implemented in scripting languages such as Javascript, Perl or Python. This is disadvantageous because the large number of script developers and existing scripting codes cannot be leveraged in plug-in programming. Before further discussing this problem, an overview of platform independent programming languages is provided.
Platform Independent Programming Language
An example of a platform independent programming language is the Java™ technology platform. A program which utilizes Java™ technology is composed of a number of classes and interfaces. Unlike many programming languages, in which a program is compiled into machine-dependent, executable program code, programs which utilize Java™ technology are compiled into machine independent bytecode class files. Each class contains code and data in a platform-independent format called the class file format. The computer system acting as the execution vehicle contains a program called a virtual machine, which is responsible for executing the code in classes. The virtual machine provides a level of abstraction between the machine independence of the bytecode classes and the machine-dependent instruction set of the underlying computer hardware. FIG. 1 is a block diagram illustrating a sample network application environment, for instance a Java™ technology network application environment, comprising a client platform 102 coupled over a network 101 to a server 100 for the purpose of accessing class files for execution of an application or applet.
Sample Network Application Environment
In FIG. 1, server 100 comprises development environment 104 for use in creating the class files for a given application. The development environment 104 provides a mechanism, such as an editor and an applet viewer, for generating class files and previewing applets. A set of core classes 103 comprise a library of classes that can be referenced by source files containing other classes. From development environment 104, one or more source files 105 are generated. Source files 105 contain the programmer readable class definitions, including data structures, method implementations and references to other classes. Source files 105 are provided to compiler 106, which compiles source files 105 into compiled “.class” files 107 that contain bytecodes executable by a virtual machine. Bytecode class files 107 are stored (e.g., in temporary or permanent storage) on server 100, and are available for download over network 101.
Client platform 102 contains a virtual machine (VM) 111 which, through the use of available native operating system (O/S) calls 112, is able to execute bytecode class files and execute native O/S calls when necessary during execution. Class files are often identified in applet tags within an HTML (hypertext markup language) document. A web server application 108 is executed on server 100 to respond to HTTP (hypertext transport protocol) requests containing URLs (universal resource locators) to HTML documents, also referred to as “web pages.” When a browser application executing on client platform 102 requests an HTML document, such as by forwarding URL 109 to web server 108, the browser automatically initiates the download of the class files 107 identified in the applet tag of the HTML document. Class files 107 are typically downloaded from the server and loaded into virtual machine 111 individually as needed.
It is typical for the classes of a program to be loaded as late during the program's execution as possible; they are loaded on demand from the network (stored on a server), or from a local file system, when first referenced during the program's execution. The virtual machine locates and loads each class file, parses the class file format, allocates memory for the class's various components, and links the class with other already loaded classes. This process makes the code in the class readily executable by the virtual machine.
Plug-In API
With the understanding of platform independent programming languages and networking environment in place, the obstacles of non-scriptable Plug-in API is now discussed. There are two main obstacles. First, current plug-in APIs are non-scriptable, meaning that they cannot be implemented in scripting languages such as Javascript, Perl or Python. This is disadvantageous because the large number of script developers and existing scripting codes cannot be leveraged in plug-in programming.
The second obstacle is found the non-scriptable limitation of XPCOM (Cross Platform Component Object Model). XPCOM is a technology that allows software components written in various programming languages to communicate with one another within the browser environment. However, the powerful potential of having software modules written in different languages working together does not extend to modules written in scripting languages. As such, software components developed in XPCOM cannot be bound to software modules implemented in scriptable languages.